package com.ivan.stu.notetool.network.intercepter;

import io.reactivex.ObservableSource;
import io.reactivex.ObservableTransformer;
import io.reactivex.android.schedulers.AndroidSchedulers;


/**
 * Description: 网络线程通用链
 */
public class NetworkTransformer {


    public static <T> ObservableTransformer<T, T> commonSchedulers() {

        return new ObservableTransformer<T, T>(){
            @Override
            public ObservableSource<T> apply(io.reactivex.Observable<T> upstream) {
                return upstream.subscribeOn(io.reactivex.schedulers.Schedulers.io())
                        .observeOn(AndroidSchedulers.mainThread());
            }
        };
    }
}
